﻿#pragma once
#include <QColor>
#include <QPainter>
#include <QPropertyAnimation>
#include <QSequentialAnimationGroup>
#include <QWidget>
#include <global/GobalMacro.hpp>

class VLIB_EXPORT BreathingLight : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(int alpha READ alpha WRITE setAlpha)

public:
    /// @brief constructor
    /// @param parent 父对象
    BreathingLight(QWidget *parent = nullptr);
	
    /// @brief 获取透明度
    /// @return 返回当前透明度的值
    inline int alpha() const { return m_alpha; }

    /// @brief 设置透明度
    /// @param alpha 透明度值
    inline void setAlpha(int alpha)
    {
        m_alpha = alpha;
        update(); // 更新窗口，触发重绘事件
    }

protected:
    /// @brief 自定义绘制事件
    /// @param event 控件绘制事件
    void paintEvent(QPaintEvent *event) override;
private:
    int m_alpha;
};
